package reader.components;

import java.util.Map;

import reader.xml.XMLContext;
import reader.xml.XMLHelper;

import components.AbstractComponent;
import components.Form;

public class FormRW extends AbstractComponentRW {

    private static final String DESCRIPTION = "description";

    public FormRW(Map<String, AbstractComponent> opened) {
        super(opened);
    }

    @Override
    public void read(AbstractComponent component, XMLContext context) {
        ((Form) component).setDescription(XMLHelper.readStringProperty(context, DESCRIPTION));
        super.read(component, context);
    }

    @Override
    public void write(AbstractComponent component, XMLContext context) {
        XMLHelper.writeProperty(context, DESCRIPTION, ((Form) component).getDescription());
        super.write(component, context);
    }

}
